#include "mad.h"
#include "SDK.h"

class MusicCodec {
private:
	std::ifstream* file;
	char* str;
	FileInfo info;
	mad_decoder decoder;

    int TimePosition;
	int FileBufferSize;
	int PCMBufferSize;
	int ScaleTo;

	int BufferPosition;

	mad_flow InputRequest(mad_stream* stream);
	mad_flow OutputPreCallback(const mad_header* header, mad_pcm* pcm);
public:
    int TimeSeeking;
	FileInfo GetFileInfo();
	void ChangeFile(std::string FileName);
	int BeginDecoding();
	MusicCodec(std::string FileName);
	~MusicCodec() {
		mad_decoder_finish(&decoder);
	}
};
